import 'dart:convert';

AssessmentRecordDto assessmentRecordDtoFromJson(String str) =>
    AssessmentRecordDto.fromJson(json.decode(str));

String assessmentRecordDtoToJson(AssessmentRecordDto data) =>
    json.encode(data.toJson());

class AssessmentRecordDto {
  AssessmentRecordDto({
    this.assessmentId,
    this.audioType,
    this.bookCode,
    this.kind,
    this.mode,
    this.questionGroupId,
    this.record,
    this.textType,
    this.type,
    this.userName,
  });

  String? assessmentId;
  String? audioType;
  String? bookCode;
  String? kind;
  String? mode;
  String? questionGroupId;
  List<Record>? record;
  String? textType;
  String? type;
  String? userName;

  factory AssessmentRecordDto.fromJson(Map<String, dynamic> json) =>
      AssessmentRecordDto(
        assessmentId: json["assessmentId"],
        audioType: json["audioType"],
        bookCode: json["bookCode"],
        kind: json["kind"],
        mode: json["mode"],
        questionGroupId: json["questionGroupId"],
        record: json["record"] != null
            ? List<Record>.from(json["record"].map((x) => Record.fromJson(x)))
            : null,
        textType: json["textType"],
        type: json["type"],
        userName: json["userName"],
      );

  Map<String, dynamic> toJson() => {
        "assessmentId": assessmentId,
        "audioType": audioType,
        "bookCode": bookCode,
        "kind": kind,
        "mode": mode,
        "questionGroupId": questionGroupId,
        "record": record != null
            ? List<dynamic>.from(record!.map((x) => x.toJson()))
            : null,
        "textType": textType,
        "type": type,
        "userName": userName,
      };
}

class Record {
  Record({
    this.answer,
    this.number,
    this.questionId,
    this.intelligenceScore,
  });

  List<String>? answer;
  int? number;
  String? questionId;
  int? intelligenceScore;

  factory Record.fromJson(Map<String, dynamic> json) => Record(
        answer: json["answer"] != null
            ? List<String>.from(json["answer"].map((x) => x))
            : null,
        number: json["number"],
        questionId: json["questionId"],
        intelligenceScore: json["intelligenceScore"] == null
            ? null
            : json["intelligenceScore"],
      );

  Map<String, dynamic> toJson() => {
        "answer":
            answer != null ? List<dynamic>.from(answer!.map((x) => x)) : null,
        "number": number,
        "questionId": questionId,
        "intelligenceScore":
            intelligenceScore == null ? null : intelligenceScore,
      };
}
